<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <script src="js/mui.min.js"></script>
    <link href="css/mui.min.css" rel="stylesheet"/>
  	<script src="js/jquery-3.1.1.min.js"></script>
  	<script type="text/javascript" src="js/my.js" ></script>
  	<style>
  		body{
			background: white;
		}
		.mui-content{
			background: white;
		}
		.mui-bar-nav{
	    	background: #53C8F4;
	    	
	    }
	    .mui-bar-nav h1{
	    	color: white;
	    }
  	</style>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav">
		    
		    <h1 class="mui-title">设置</h1>
		</header>
			<!--单页面开始-->
		<div class="mui-content">
			<ui class="mui-table-view">
				<li class="mui-table-view-cell mui-media" style="background-color: white;margin-top: 15px;" >
					<a href="javascript:;">
						<img class="mui-media-object mui-pull-left" src="images/logo.png" style="margin-right: 15px;">
						<div class="mui-media-body">
							初心
							<p  id="username"></p>
				
						</div>
					</a>
				</li>
			</ui>
			<ui class="mui-table-view">
				<li class="mui-table-view-cell"  style="background-color: white;margin-top: 30px;">
						<a href="javascript:;" class="mui-navigate-right">
						<span class="mui-icon mui-icon-pengyouquan" style="color: dodgerblue; margin-right: 10px;"></span><span>完善个人资料</span>
					</a>
				</li>
				
				<li class="mui-table-view-cell"  style="background-color: white;">
						<a href="javascript:;" class="mui-navigate-right">
						<span class="mui-icon mui-icon-person" style="color: red;margin-right: 10px;"></span><span>更改密码</span>
					</a>
				</li>
				<li class="mui-table-view-cell"  style="background-color: white;margin-top: 30px;">
						<a href="javascript:;" class="mui-navigate-right">
						<span class="mui-icon mui-icon-gear" style="color:blue; margin-right: 10px;"></span><span>设置</span>
					</a>
				</li>             
			</ui>
			
		</div>
		
		<script>
			
			mui.init();
			var userInfo = JSON.parse(localStorage.getItem("userInfo"));
			var url = localStorage.getItem("url");
			var realUrl=url+"/user/getUser"
			mui.ajax(realUrl, {
				data: {
						id: userInfo,
					},

						//服务器返回json格式数据 
						type: 'post', //HTTP请求类型
						timeout: 10000, //超时时间设置为10秒；
						success: function(data) {
							if(data.code==0){
			                    $("#username").html("账号："+data.data.username);
							}
						},
						error: function(xhr, type, errorThrown) { //异常处理；
							console.log(type);
						}
					});
			
			var cell = document.getElementsByClassName("mui-table-view-cell");
			cell[1].addEventListener('tap',function() {
				if(userInfo==null) {
					alert("请先去登录");
					return;
				}else {
					my.jump("perfectinfo.html","perfection");
				}
			});
			cell[2].addEventListener('tap',function() {
				if(userInfo==null) {
					alert("请先去登录");
					return;
				}else {
					my.jump("updatepsw.html","update");
				}
			});
			cell[3].addEventListener('tap',function() {
				if(userInfo==null) {
					alert("请先去登录");
					return;
				}else {
					my.jump("setting.html","setting");
				}
			});
		</script>
	</body>
</html>
